using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;

using SharpCore.Data;
using SystemFramework.Util;

namespace TF.Access
{
    public partial class Tf_pic
    {
        /// <summary>
        /// Selects all records from the tf_pics table.
        /// </summary>
        public static List<Tf_pic> SelectByAlbumId(int uid, int albumId, int pageSize, int pageIndex, out int count)
        {
            count = 0;
            using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader("TF_picsSelectByAlbumId", uid, albumId, pageSize, pageIndex))
            {
                List<Tf_pic> tf_picList = new List<Tf_pic>();
                while (dataReader.Read())
                {
                    Tf_pic tf_pic = MakeTf_pic(dataReader);
                    tf_picList.Add(tf_pic);
                }

                if (dataReader.NextResult())
                {
                    if (dataReader.Read())
                    {
                        count = ConvertHelper.GetInt(dataReader[0], 0);
                    }
                }

                return tf_picList;
            }
        }
    }
}
